<?php
if(isset($_GET)){
    include_once 'module/controls.php';
    include_once 'model/user/user_create.php';

    $c = new controls();
    $user = new users();
    $fillOne = $user->fill_one($_GET);
    $chucnang = $fillOne["level"];
    $json_chucnang = json_decode($chucnang, true);
    $create = $json_chucnang["create"];
    $update = $json_chucnang["update"];
    $delete = $json_chucnang["delete"];
?>
<div id="content">
    <div class="content_block">
        <h2 class="jquery_tab_title"><?php echo $phrase["manager_user"] ?></h2>
        <form method="post" action="<?=$url["home"] ?>/menu/process">
            <p>
                <?php echo $c->get_textHidden("id", $_GET["id"]) ?>
                <?php echo $c->get_label($phrase["fullname"]) ?>
                <?php echo $c->get_text("fullname", $fillOne["user_fullname"]) ?>
                <span id="error_email"></span>
            </p>
            
            <p>
                <?php echo $c->get_label($phrase["email"]) ?>
                <?php echo $c->get_text("email", $fillOne["user_email"]) ?>
                <span id="error_email"></span>
            </p>

            <p>
                <?php echo $c->get_label($phrase["phone"]) ?>
                <?php echo $c->get_text("phone", $fillOne["user_phone"]) ?>
            </p>
            
            <p>
                <?php echo $c->get_checkbox("create", "create", $create); ?>
                <?php echo $c->get_label("Create", "inline") ?>
                <?php echo $c->get_checkbox("update", "update", $update) ?>
                <?php echo $c->get_label("Update", "inline") ?>
                <?php echo $c->get_checkbox("delete", "delete", $delete) ?>
                <?php echo $c->get_label("Delete", "inline") ?>
            </p>
            
            <p>
                <?php echo $c->get_button("update",$phrase["update"]) ?>
            </p>
        </form>
    </div>
</div>
<script>
    $("#username").keydown(function(e){
        if(e.keyCode == "32"){
            return false;
        }
    });
    
    $(document).ready(function(){
        $('#username').keyup(username_check);
        $('#password').keyup(remove_mgs);
        $('#cpassword').keyup(remove_mgs);
        $('#phone').keyup(remove_mgs);
        $('#email').keyup(remove_mgs);
        $('#fullname').keyup(remove_mgs);
        $('.button').click(checkuser);
        $("#phone").keydown(isNumbericOnly);
    });
</script>
<?php } ?>